<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>12-对象中箭头函数和常规函数this</title>
</head>
<body>
    <script>
        /**
         * 在对象中定义常规方法，this指向的是本对象
         * 而箭头函数中的this指向的是window对象
         */
        var shei = '李宝莉';
        var mobile={
            sendmsg:function(){
                console.log(this);//指向的是var mobile={}对象
                console.log('发短信...');
            },
            ocall:()=>{
                console.log(this);//Window
                console.log('打电话'+shei);
            }
        };

        mobile.ocall();
        mobile.sendmsg();
    </script>
</body>
</html>